from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE `oa_job` ADD `pid_id` INT COMMENT '父岗位id';
        ALTER TABLE `oa_job` ADD CONSTRAINT `fk_oa_job_oa_job_f7a1aaba` FOREIGN KEY (`pid_id`) REFERENCES `oa_job` (`id`) ON DELETE SET NULL;"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE `oa_job` DROP FOREIGN KEY `fk_oa_job_oa_job_f7a1aaba`;
        ALTER TABLE `oa_job` DROP COLUMN `pid_id`;"""
